package com.zzt.zt_hilt.entity

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import javax.inject.Qualifier

/**
 * @author: zeting
 * @date: 2022/8/29
 *
 */
//还是一样的模式，定义一个模块
@Module
@InstallIn(ActivityComponent::class)
object CompanyModule1 {


    //修饰注解的注解
//这里就定义了2种限定符
    @Qualifier
    @Retention(AnnotationRetention.BINARY)
    annotation class CurrentCompany

    @Qualifier
    @Retention(AnnotationRetention.BINARY)
    annotation class LastCompany


    //这里Company区分开，提供@CurrentCompany类型的实例
    @CurrentCompany
    @Provides
    fun provideCompany(): Company {
        return CompanyInfo.getCompany()
    }

    @LastCompany
    @Provides
    fun provideLastCompany(): Company {
        return Shopping()
    }

    private fun Shopping(): Company {

        return CompanyInfo.getCompany()
    }

}

